
package util;

import java.io.FileInputStream;
import java.util.Properties;



/**
 * Clase para cargar el fichero de fileConfiguration.properties
 */
public class Configuration extends Properties
{
    // Nombre del fichero de configuraci�n
    private static final String CONFIGURATION_FILE =
        "com/";
    
    //ruta del fichero properties
     private static String path ="";
    

    
    // Atributo para el singleton
    private static Configuration instance = null;

    private Configuration()
    {
        super();
        loadConfiguration();
        
    }

    public static Configuration getInstance() 
    {
        if (instance == null)
        {
            instance = new Configuration();
        }
        return instance;
    }
    
     private void loadConfiguration()
    {
        FileInputStream file = null;
        try
        {
            file = new FileInputStream(path);
            this.load(file);
            file.close();
            
        }
        catch (Exception ex)
        {
           ex.printStackTrace();
        }
    }
     
    public static void initPath(String newPath) 
    {
        path = newPath + CONFIGURATION_FILE;
    }

    
    public static String getPath() 
    {
        return path;
    }

    
    
    
}
